package cn.zymall.app.controller.ad;

import cn.zymall.app.service.AdvertisingService;
import cn.zymall.common.model.Advertising;
import cn.zymall.common.utils.response.HttpResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author xuxianda
 * @Description: TODO(这里用一句话描述作用)
 * @date 2020/8/26 20:41
 * @Copyright
 * @return
 **/
@RestController
@RequestMapping("/advertising")
public class AdController {
    @Autowired
    AdvertisingService advertisingService;

    @GetMapping
    public HttpResult getAd() {
        return advertisingService.select();
    }

    @PostMapping
    public HttpResult save(@RequestBody Advertising advertising) {
        System.out.println(advertising);
        return advertisingService.save(advertising);
    }

}
